package com.cgsd.heyu.ui.task.adapter;

import com.cgsd.heyu.R;
import com.cgsd.heyu.ui.task.vo.TaskListVo;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

/**
 * Author: sky on 2021/3/2 17:22
 * Email: xcode126@126.com
 * Desc:
 */
public class TaskClassifyAdapter extends BaseQuickAdapter<TaskListVo.CatelistBean, BaseViewHolder> {

    private int selected;

    public TaskClassifyAdapter() {
        super(R.layout.item_classify_task);
    }

    @Override
    protected void convert(BaseViewHolder helper, TaskListVo.CatelistBean item) {
        helper.getView(R.id.tv_content).setSelected(helper.getAdapterPosition() == selected);
        helper.setText(R.id.tv_content,item.name);
    }

    public void setSelected(int selected) {
        this.selected = selected;
        notifyDataSetChanged();
    }
}
